package com.flex.core.model.base
{
	import com.flex.core.constants.GameConstants;
	
	import flash.display.DisplayObject;
	import flash.display.Sprite;

	/**
	 * @author sam
	 */
	public class GameGridSprite extends Sprite
	{

		public var mapX:Number;

		public var mapY:Number;

		public var gridWidth:int;

		public var gridHeight:int;

		public var gridState:uint;

		public var id:String;

		public var gridType:Number;
		
		public var isBaseUserPosition:Boolean;
		
		public function getIsBaseUserPosition():Boolean
		{
			return isBaseUserPosition;
		}

		public function getGridType():Number
		{
			return gridType;
		}

		public function getGridWidth():int
		{
			return gridWidth;
		}


		public function getGridHeight():int
		{
			return gridHeight;
		}


		public function getId():String
		{
			return id;
		}


		public function getUint():uint
		{
			return gridState;
		}

		public function getMapX():Number
		{
			return mapX;
		}

		public function getMapY():Number
		{
			return mapY;
		}

		public function GameGridSprite(gridWidth:int=0, gridHeight:int=0, mapX:Number=0, mapY:Number=0, gridState:uint=0, id:String=null, gridType:Number=0,isBaseUserPosition:Boolean = false):void
		{
			this.mapX=mapX;
			this.mapY=mapY;
			this.gridState=gridState;
			this.id=id;
			this.gridHeight=gridHeight;
			this.gridWidth=gridWidth;
			this.gridType=gridType;
			this.isBaseUserPosition = isBaseUserPosition;
			super();
		}

		/**
		 * 重写addChild方法，主要是为了把id放入规则管理
		 */
		override public function addChild(child:DisplayObject):DisplayObject
		{
			GameConstants.BASE_ELE_MAP.puts(child["id"], child);
			return addChildAt(child, numChildren);
		}


	}
}